<?php
namespace Common\Controller;
use Think\Controller;
class CommonController extends Controller {
  protected function _initialize(){
      
  }
    

  public function _empty(){
    header('HTTP/1.1 404 Not Found'); 
    $this->display( 'Public:404' );
  }
  /**
   * 根据IP获取当前城市
   */
  public function getcity(){
      $ip='122.68.39.9';
      $content = file_get_contents("http://api.map.baidu.com/location/ip?ak=3j2s1pCFpoATNL5tcr014rqZbDV8EUh6&ip={$ip}&coor=bd09ll");
      $city_info = json_decode($content);
      $city_name=$city_info->{'content'}->{'address_detail'}->{'city'};
      return $city_name;
  }
}